import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import vitePluginImp from 'vite-plugin-imp'
import vitePluginEslint from 'vite-plugin-eslint'
// 环境变量
process.env.VITE_APP_VERSION = require('./package.json').version
// 基础路劲 注意发布之前要先修改改这里
const publicDir = process.env.VITE_APP_PUBLIC_PATH || 'public'

export default defineConfig({
  base: '/',
  publicDir: publicDir,
  server: {
    port: 8080,
    open: true,
    // 反向代理配置
    proxy: {
    }
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
      pub: resolve(__dirname, './public'),
      vue: 'vue/dist/vue.esm-bundler.js'
    }
  },
  plugins: [
    vue(),
    vitePluginEslint({
      cache: false
    }),
    vitePluginImp({
      libList: [
        // {
        //   libName: 'element-plus',
        //   style: (name) => {
        //     return `element-plus/lib/theme-chalk/${name}.css`
        //   }
        // },
      ]
    })
  ]
})
